using ExitGames.Client.Photon;

public static class PhotonPlayerExtentions
{
	public static void UpdateProperty(this PhotonPlayer photonPlayer, object key, object value)
	{
		if (!settings.offlineMode)
		{
			photonPlayer.SetCustomProperties(new Hashtable { { key, value } });
		}
	}

	public static T GetValueByKey<T>(this PhotonPlayer photonPlayer, string key, T defaultValue)
	{
		if (photonPlayer == null)
		{
			return defaultValue;
		}
		if (settings.offlineMode)
		{
			return defaultValue;
		}
		return (!photonPlayer.customProperties.ContainsKey(key)) ? defaultValue : ((T)photonPlayer.customProperties[key]);
	}
}
